-
Notifications
You must be signed in to change notification settings - Fork 69
chore: Test of connection rest between routing #4355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v3.x.x
Are you sure you want to change the base?
Conversation
…ying POST - reactor.netty.http.client.PrematureCloseException) Signed-off-by: Pavel Jareš <Pavel.Jares@broadcom.com>
| void givenConnectionInPool_whenServerWasRestarted_thenRetry(String method, MockService.ConnectionCleanupType cleanupType, int responseStatus) { | ||
| var port = mockService.getPort(); | ||
|
|
||
| given() | ||
| .header(HEADER_X_FORWARD_TO, "serviceid1") | ||
| .when() | ||
| .get(basePath + "/200") | ||
| .then() | ||
| .statusCode(is(SC_OK)); | ||
|
|
||
| mockService.cleanConnections(cleanupType); | ||
|
|
||
| var port2 = mockService.getPort(); | ||
| assertEquals(port, port2); | ||
|
|
||
| given() | ||
| .header(HEADER_X_FORWARD_TO, "serviceid1") | ||
| .when() | ||
| .request(method, basePath + "/200") | ||
| .then() | ||
| .statusCode(is(responseStatus)); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand what the purpose of this test is, what happens if you try to send the request before cleaning up? Would that make the purpose more clear?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so. The first request is to warn up. It means the pool on both services side is established. The clean-up close connection on one side (the type simulate a specific operation) and the second call verify the handling of closed connection. We can make as many request we want before. It cannot change the behaviour after clean up. And the issue is related to the first call after clean-up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm just wondering what does it take to break this test, that's the part that's not very clear for me. Or which part of the API ML does not work otherwise, it feels to me that it's testing the mock service rather, but if it's clear to you it's fine with me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is testing the retry logic and handling connection in the outbound calls (see HTTP client in the gateway), If there is a change in handling I/O exceptions of prepared connection or retry logic it could break the test.
Description
This PR add a test that simulate one known issue about communication to the service. When communication is broken it stop sending a request and an exception is thrown.
The point is that GET request could be retried (GET means no change on remote side), but for POST it depends on the state. If request was sent (at least from application point of view) we cannot retry it, because it could be effective done twice. We can potentially retry other method than GET only if the error happened before sending the data.
This test could be helpfull in case of replacing HTTP client or for reproducing a similar issue. It definetelly cover these edge cases and define current state.
Linked to # (issue)
Part of the # (epic)
Type of change
Please delete options that are not relevant.
Checklist:
For more details about how should the code look like read the Contributing guideline